/*
* @Author: Marte
* @Date:   2018-11-01 10:04:05
* @Last Modified by:   Marte
* @Last Modified time: 2018-11-02 15:56:49
*/
const {Staff} = require("../model/model.js");

const StaffDao = {
	save(staffinfo){
		const staff = new Staff(staffinfo);
		return staff.save();
	},
	find(condition){
		return Staff.find(condition);
	},
	findByPage(page){
		const pageSize = 5;
		return Staff.find({}).limit(pageSize).skip((page - 1) * pageSize);
	},
	removeById(id){
		return Staff.findByIdAndDelete(id);
	},
	update(condition,info){

		return Staff.findByIdAndUpdate(condition,info);
	}

};
module.exports = StaffDao;
